<template>
  <div class="com_infoForm">
<!--    <div style="display: flex;justify-content: right;padding:10px;background:white;" v-if="btnShow">
      <van-button color="#7232dd" plain round  size="small" style="margin-right: 10px;" @click="chDataRes('source')">使用源数据</van-button>
      <van-button type="danger" plain round  size="small" @click="chDataRes('save')">使用保存数据</van-button>
    </div> -->
    <van-tabs v-model="active" scrollspy sticky color="#1989fa" swipe-threshold="4">
      <van-form @submit="onSubmit" @failed="onFailed" scroll-to-error ref="formFieldBox">
        <van-tab title="基础信息">
          <div>
            <van-divider
              :style="{
                color: '#020202',
                borderColor: '#DD4F42',
                padding: '10px 100px 0',
                margin: '0'
              }"
            >基础信息</van-divider>
<!-- <<<<<<< Updated upstream -->
            <!-- <quillEditor :jobContent='job_content' @change="costPlannedAmountChange($event)" @autoFill="autofill_handle" @fill_contact="fill_contact_handle"></quillEditor> -->
<!-- ======= -->
<!-- >>>>>>> Stashed changes -->
            <quillEditor :jobContent='job_content' :status="1" @change="costPlannedAmountChange($event)" @autoFill="autofill_handle" @fill_contact.native="fill_contact_handle">
              <template #btns v-if="btnShow">
                <van-col span="8" style="text-align: center;color:rgb(114, 50, 221)" >
                  <span  @click="chDataRes('source')">使用源数据</span>
                </van-col>
                <van-col span="8" style="text-align: right;color:#ee0a24">
                  <span  @click="chDataRes('save')">使用保存数据</span>
                </van-col>
              </template>
            </quillEditor>
            <!-- <van-field
              v-model="job_content"
              rows="4"
              autosize
              label="招聘详情"
              type="textarea"
              placeholder="请输入招聘详情信息"
              show-word-limit
            /> -->
            <!--  发布类型  -->
            <van-field
              autocomplete="off"
              name="job_category_id"
              label="发布类型"
              v-if="jobTypeList.length"
            >
              <template #input>
                <van-radio-group
                  v-model="job_category_id"
                  direction="horizontal"
                  style="margin-bottom: -10px"
                >
                  <van-radio
                    v-for="item in jobTypeList"
                    :name="item.id"
                    :key="item.id"
                    style="margin-bottom: 10px"
                  >
                    {{item.title }}
                  </van-radio>
                </van-radio-group>
              </template>
            </van-field>

            <!-- 企业名称   -->
            <van-field
              autocomplete="off"
              v-model="enterprise_name"
              name="enterprise_name"
              label="企业名称"
              placeholder="请输入企业名称(必填)"
              type="textarea"
              rows="1"
              autosize
            />
            <!-- 招聘信息  -->
            <div class="redtext">
              <van-field
                autocomplete="off"
                v-model="recruiting_position"
                name="recruiting_position"
                label="招聘职位"
                placeholder="请输入招聘职位(必填)"
                type="textarea"
                rows="1"
                autosize
              >
                <template #label>
                  <p class="redtext" @click="savelocal('recruiting_position')">招聘职位<br>保存招聘职位</p>
                </template>
              </van-field>
            </div>
            <!-- 招聘人数  -->
            <!-- <van-field
              autocomplete="off"
              type="number"
              v-model="recruiting_numbers"
              name="recruiting_numbers"
              label="招聘人数"
              right-icon="video-o"
              @click-right-icon="rightClick"
              placeholder="请输入招聘人数(必填)"
            /> -->
            <!-- 工作时间说明  -->
            <!-- <van-field
              autocomplete="off"
              v-model="work_days"
              name="work_days"
              label="工作时间"
              right-icon="video-o"
              @click-right-icon="rightClick"
              placeholder="请输入工作时间说明(必填)"
              type="textarea"
              rows="1"
              autosize
              :rules="[
                {
                  validator: value => {
                    return wordCountLimit(value, 500)
                  },
                  message: '工作时间长度不能超过500位'
                }
              ]"
            /> -->
            <!-- 休息日说明  -->
            <!-- <van-field
              autocomplete="off"
              v-model="res_days"
              name="res_days"
              label="休息时间"
              right-icon="video-o"
              @click-right-icon="rightClick"
              placeholder="请输入休息时间说明(必填)"
              type="textarea"
              rows="1"
              autosize
              :rules="[
                {
                  validator: value => {
                    return wordCountLimit(value, 500)
                  },
                  message: '休息时间长度不能超过500位'
                }
              ]"
            /> -->
            <!--  职位属性  -->
            <div class="greentext">
            <van-field
              autocomplete="off"
              name="position_id"
              label="职位属性"
              v-if="positionIdList.length"
            >
              <template #input>
                <van-checkbox-group
                  v-model="position_ids"
                  direction="horizontal"
                  style="margin-bottom: -10px"
                >
                  <van-checkbox
                    v-for="item in positionIdList"
                    shape="square"
                    :name="item.key"
                    :key="item.key"
                    style="margin-bottom: 10px"
                  >{{ item.value }}</van-checkbox>
                </van-checkbox-group>
              </template>
            </van-field>
          </div>
            <!--  班制属性  -->
            <div class="greentext">
            <van-field
              autocomplete="off"
              name="class_attribute_id"
              label="班制属性"
              v-if="classAttributeIdList.length"
            >
              <template #input>
                <van-checkbox-group
                  v-model="class_attribute_ids"
                  direction="horizontal"
                  style="margin-bottom: -10px"
                >
                  <van-checkbox
                    v-for="item in classAttributeIdList"
                    shape="square"
                    :name="item.key"
                    :key="item.key"
                    style="margin-bottom: 10px"
                  >{{ item.value }}</van-checkbox>
                </van-checkbox-group>
              </template>
            </van-field>
          </div>
          <div class="greentext">
             <van-field
              autocomplete="off"
              name="IsWithPhone"
              label="上班是否可带手机"
            >
              <template #input>
                <van-checkbox-group
                  v-model="IsWithPhones"
                  direction="horizontal"
                  style="margin-bottom: -10px"
                >
                  <van-checkbox shape="square" :name="'0'" style="margin-bottom: 10px">可带</van-checkbox>
                  <van-checkbox shape="square" :name="'1'" style="margin-bottom: 10px">不可带</van-checkbox>
                </van-checkbox-group>
              </template>
            </van-field>
          </div>
          <div class="greentext">
            <van-field
              autocomplete="off"
              name="IsWearCleanClothes"
              label="上班是否穿无尘服"
            >
              <template #input>
                <van-checkbox-group
                  v-model="IsWearCleanClothess"
                  direction="horizontal"
                  style="margin-bottom: -10px"
                >
                  <van-checkbox shape="square" :name="'0'" style="margin-bottom: 10px">必须穿</van-checkbox>
                  <van-checkbox shape="square" :name="'1'" style="margin-bottom: 10px">不穿</van-checkbox>
                </van-checkbox-group>
              </template>
            </van-field>
          </div>
          <div class="greentext">
            <van-field
              autocomplete="off"
              name="vision"
              label="入职是否体检"
            >
              <template #input>
                <van-checkbox-group
                  v-model="visions"
                  direction="horizontal"
                  style="margin-bottom: -10px"
                >
                  <van-checkbox shape="square" :name="0" style="margin-bottom: 10px">体检</van-checkbox>
                  <van-checkbox shape="square" :name="1" style="margin-bottom: 10px">不体检</van-checkbox>
                </van-checkbox-group>
              </template>
            </van-field>
          </div>
            <!-- <van-field
              autocomplete="off"
              v-model="job_content"
              name="job_content"
              label="工作内容"
              right-icon="video-o"
              @click-right-icon="rightClick"
              placeholder="请输入工作内容、岗位职责(必填)"
              type="textarea"
              rows="1"
              autosize
              :rules="[
                {
                  validator: value => {
                    return wordCountLimit(value, 500)
                  },
                  message: '工作内容长度不能超过500位'
                }
              ]"
            />
            <van-field
              autocomplete="off"
              v-model="job_environment"
              name="job_environment"
              label="工作环境"
              right-icon="video-o"
              @click-right-icon="rightClick"
              placeholder="请输入工作环境(必填)"
              type="textarea"
              rows="1"
              autosize
              :rules="[
                {
                  validator: value => {
                    return wordCountLimit(value, 500)
                  },
                  message: '工作环境长度不能超过500位'
                }
              ]"
            />

            <van-field
              autocomplete="off"
              v-model="completion_instructions"
              name="completion_instructions"
              label="旷工说明"
              right-icon="video-o"
              @click-right-icon="rightClick"
              placeholder="请输入旷工说明(必填)"
              type="textarea"
              rows="1"
              autosize
              :rules="[
                {
                  validator: value => {
                    return wordCountLimit(value, 500)
                  },
                  message: '旷工说明长度不能超过500位'
                }
              ]"
            />

            <van-field
              autocomplete="off"
              v-model="self_explanation"
              name="self_explanation"
              label="自离说明"
              right-icon="video-o"
              @click-right-icon="rightClick"
              placeholder="请输入自离说明(必填)"
              type="textarea"
              rows="1"
              autosize
              :rules="[
                {
                  validator: value => {
                    return wordCountLimit(value, 500)
                  },
                  message: '自离说明长度不能超过500位'
                }
              ]"
            />

            <van-field
              autocomplete="off"
              v-model="resignation_instructions"
              name="resignation_instructions"
              label="辞职说明"
              right-icon="video-o"
              @click-right-icon="rightClick"
              placeholder="请输入辞职说明(必填)"
              type="textarea"
              rows="1"
              autosize
              :rules="[
                {
                  validator: value => {
                    return wordCountLimit(value, 500)
                  },
                  message: '辞职说明长度不能超过500位'
                }
              ]"
            />

            <van-field
              autocomplete="off"
              v-model="other_description"
              name="other_description"
              label="其他说明"
              right-icon="video-o"
              @click-right-icon="rightClick"
              placeholder="请输入其他说明"
              type="textarea"
              rows="1"
              autosize
              :rules="[
                {
                  validator: value => {
                    return wordCountLimit(value, 500)
                  },
                  message: '其它说明长度不能超过500位'
                }
              ]"
            /> -->

            <van-field
              autocomplete="off"
              name="photos"
              label="上传图片"
            >
              <template #input>
                <van-uploader
                  v-model="photos"
                  :preview-options="{
                    closeable: true
                  }"
                  :max-count="9"
                  :after-read="uploadPhotoList"
                  @delete="toDeleteAnyPreviewPhoto"
                  :deletable="
                    (jobDetailInfo && jobDetailInfo.status == 2) ||
                      ['publishJob', 'canShare', 'jobSheet'].includes(keyword)
                  "
                  :show-upload="
                    (jobDetailInfo && jobDetailInfo.status == 2) ||
                      ['publishJob', 'canShare', 'jobSheet'].includes(keyword)
                  "
                />
              </template>
            </van-field>

            <van-field
              autocomplete="off"
              name="job_videos"
              label="上传视频"
              class="videosNote"
            >
              <template #input>
                <van-uploader
                  upload-text="只能上传MP4格式的视频"
                  accept="video/*"
                  v-model="job_videos"
                  @click-preview="previewJobVideos"
                  :max-count="9"
                  :after-read="uploadPhotoList_ForJobVideos"
                  @delete="toDeleteAnyPreviewPhoto_ForJobVideos"
                  :deletable="
                    (jobDetailInfo && jobDetailInfo.status == 2) ||
                      ['publishJob', 'canShare', 'jobSheet'].includes(keyword)
                  "
                  :show-upload="
                    (jobDetailInfo && jobDetailInfo.status == 2) ||
                      ['publishJob', 'canShare', 'jobSheet'].includes(keyword)
                  "
                >
                  <template #preview-cover>
                    <van-image width="80" height="80" :src="videoIcon" />
                  </template>
                </van-uploader>
              </template>
            </van-field>
          </div>
        </van-tab>
        <van-tab title="薪资福利">
          <div>
            <van-divider
              :style="{
                color: '#020202',
                borderColor: '#DD4F42',
                padding: '10px 100px 0',
                margin: '0'
              }"
            >薪资福利</van-divider>

            <!--   算薪方式  -->
            <van-field
              autocomplete="off"
              name="pay_money_mode"
              label="算薪方式"
            >
              <template #input>
                <van-radio-group
                  v-model="pay_money_mode"
                  direction="horizontal"
                  style="margin-bottom: -10px"
                  @change="toChangePayWayId"
                >
                <van-radio
                    v-for="(item, index) in calcPayMoneys"
                    :name="item.id"
                    :key="index+101"
                    style="margin-bottom: 10px"
                    class="greentxt"
                  >{{ item.name }}</van-radio>
                  <van-radio
                    v-for="(item, index) in nocalcPayMoneys"
                    :name="item.id"
                    :key="index"
                    style="margin-bottom: 10px"
                  >{{ item.name }}</van-radio>
                </van-radio-group>
              </template>
            </van-field>
            <template v-if="pay_money_mode !== '13'">
            <van-field
              autocomplete="off"
              type="number"
              v-model="pay_mode_name"
              name="pay_mode_name"
              :label="payMoneyModeName[pay_money_mode]"
              :placeholder="`请输入${payMoneyModeName[pay_money_mode]}(必填)`"
              v-if="pay_money_mode"
            >
              <template #input>
                <div
                  v-if="
                    pay_money_mode === '0' ||
                      pay_money_mode === '3' ||
                      pay_money_mode === '8' ||
                      pay_money_mode === '9' ||
                      pay_money_mode === '10' ||
                      pay_money_mode === '11' ||
                      pay_money_mode === '12'
                  "
                >
                  <van-field
                    autocomplete="off"
                    type="number"
                    v-model="first_value_input"
                    placeholder="请输入"
                    name="first_value_input"
                    required
                    :rules="[{required: true, message: '未填写'}]"
                  />
                </div>

                <div v-else>
                  <div
                    v-if="
                      pay_money_mode === '1' ||
                        pay_money_mode === '2' ||
                        pay_money_mode === '4' ||
                        pay_money_mode === '6' ||
                        pay_money_mode === '7'
                    "
                  >
                    <van-field
                      autocomplete="off"
                      type="number"
                      v-model="first_value_input"
                      placeholder="请输入"
                      name="first_value_input"
                    />
                    <!--&plus;-->
                    <van-field
                      autocomplete="off"
                      type="number"
                      v-model="second_value_input"
                      placeholder="请输入"
                      name="second_value_input"
                    />
                  </div>
                  <div v-else-if="pay_money_mode === '5'">
                    <van-field
                      autocomplete="off"
                      type="number"
                      v-model="first_value_input"
                      placeholder="请输入"
                      name="first_value_input"
                    />
                    <!--&plus;-->
                    <van-field
                      autocomplete="off"
                      type="number"
                      v-model="second_value_input"
                      placeholder="请输入"
                      name="second_value_input"
                    />
                    <!--&plus;-->
                    <van-field
                      autocomplete="off"
                      type="number"
                      v-model="third_value_input"
                      placeholder="请输入"
                      name="third_value_input"
                    />
                  </div>
                </div>
              </template>
            </van-field>
          </template>
          <div class="calc_salary">
            <div v-if="pay_money_mode === '3' || pay_money_mode === '8'" class="calc_btn" @click="fill_salary_handle">智能计算</div>
            <van-field
              autocomplete="off"
              type="number"
              label="综合工资范围"
              placeholder="请输入综合工资(必填)"
              v-model="comprehensive_salary_range"
              name="comprehensive_salary_range"
              v-if="comprehensive_salary_range"
            >
              <template #input>
                <div>
                  <van-field
                    autocomplete="off"
                    v-model="min_comprehensive_salary"
                    placeholder="请输入综合工资最小值"
                    type="number"
                    name="min_comprehensive_salary"
                  />
                  <van-field
                    autocomplete="off"
                    type="number"
                    v-model="max_comprehensive_salary"
                    placeholder="请输入综合工资最大值"
                    name="max_comprehensive_salary"
                  />
                </div>
              </template>
            </van-field>
          </div>
          <div class="redtext">
            <van-field
              autocomplete="off"
              label-width="10em"
              style="align-items: center;"
              v-model="lend_money_amount"
              name="lend_money_amount"
              type="number"
              placeholder="请输入每周可借支的金额"
            >
            <template #label>
              <p class="redtext" @click="savelocal('lend_money_amount')">每周可借支的金额<br>保存可借支的金额</p>
            </template>
            </van-field>
            </div>

            <!-- <van-field
              autocomplete="off"
              v-model="salary_description"
              name="salary_description"
              :rules="[
                {
                  validator: value => {
                    return wordCountLimit(value, 500)
                  },
                  message: '薪资说明长度不能超过500位'
                }
              ]"
              right-icon="video-o"
              @click-right-icon="rightClick"
              label="薪资说明"
              type="textarea"
              rows="2"
              autosize
              placeholder="请输入薪资说明(必填)"
            /> -->

            <!--   发薪日  -->
            <div class="greentext">
            <van-field
              autocomplete="off"
              name="payday_id"
              label="发薪日"
              v-if="paydayIdList.length"
            >
              <template #input>
                <van-checkbox-group
                  v-model="payday_ids"
                  direction="horizontal"
                  style="margin-bottom: -10px"
                >
                  <van-checkbox
                    v-for="item in paydayIdList"
                    shape="square"
                    :name="item.key"
                    :key="item.key"
                    style="margin-bottom: 10px"
                    @click="changePayDayId(item.key)"
                  >{{ item.value }}</van-checkbox>
                </van-checkbox-group>
              </template>
            </van-field>
          </div>
            <!-- <all-types-pay-day
              v-if="payday_id != '0'"
              :payday_id="payday_id"
              :payday_mode_name="payday_mode_name"
              @getPaydayModeName="toUpdatePaydayModeName"
            /> -->
            <div class="greentext">
            <van-field
              autocomplete="off"
              name="other_benefits"
              label="福利"
              v-if="materialList.length"
            >
              <template #input>
                <van-checkbox-group
                  v-model="other_benefits"
                  direction="horizontal"
                  style="margin-bottom: -10px"
                >
                  <van-checkbox
                    v-for="item in materialList"
                    :name="item.key"
                    shape="square"
                    :key="item.key"
                    style="margin-bottom: 10px"
                  >{{ item.value }}</van-checkbox>
                </van-checkbox-group>
              </template>
            </van-field>
          </div>
            <!--  包吃 -->
            <!-- <van-field
              autocomplete="off"
              v-model="free_food"
              name="free_food"
              label="包吃"
              right-icon="video-o"
              @click-right-icon="rightClick"
              placeholder="请输入包吃说明(选填)"
              type="textarea"
              rows="1"
              autosize
              :rules="[
                {
                  validator: value => {
                    return wordCountLimit(value, 500)
                  },
                  message: '包吃说明长度不能超过500位'
                }
              ]"
            />
            <van-field
              autocomplete="off"
              v-model="provide_food"
              name="provide_food"
              label="供吃"
              right-icon="video-o"
              @click-right-icon="rightClick"
              placeholder="请输入供吃说明(选填)"
              type="textarea"
              rows="1"
              autosize
              :rules="[
                {
                  validator: value => {
                    return wordCountLimit(value, 500)
                  },
                  message: '供吃说明长度不能超过500位'
                }
              ]"
            />
            <van-field
              autocomplete="off"
              v-model="food_allowance"
              name="food_allowance"
              label="饭补"
              right-icon="video-o"
              @click-right-icon="rightClick"
              placeholder="请输入饭补说明(选填)"
              type="textarea"
              rows="1"
              autosize
              :rules="[
                {
                  validator: value => {
                    return wordCountLimit(value, 500)
                  },
                  message: '饭补说明长度不能超过500位'
                }
              ]"
            />
            <van-field
              autocomplete="off"
              v-model="social_security"
              name="social_security"
              label="社保"
              right-icon="video-o"
              @click-right-icon="rightClick"
              placeholder="请输入社保说明(选填)"
              type="textarea"
              rows="1"
              autosize
              :rules="[
                {
                  validator: value => {
                    return wordCountLimit(value, 500)
                  },
                  message: '社保说明长度不能超过500位'
                }
              ]"
            />
            <van-field
              autocomplete="off"
              v-model="insurance"
              name="insurance"
              label="保险"
              right-icon="video-o"
              @click-right-icon="rightClick"
              placeholder="请输入保险说明(选填)"
              type="textarea"
              rows="1"
              autosize
              :rules="[
                {
                  validator: value => {
                    return wordCountLimit(value, 500)
                  },
                  message: '保险说明长度不能超过500位'
                }
              ]"
            />
            <van-field
              autocomplete="off"
              v-model="encase"
              name="encase"
              label="包住"
              right-icon="video-o"
              @click-right-icon="rightClick"
              placeholder="请输入包住说明(选填)"
              type="textarea"
              rows="1"
              autosize
              :rules="[
                {
                  validator: value => {
                    return wordCountLimit(value, 500)
                  },
                  message: '包住说明长度不能超过500位'
                }
              ]"
            />
            <van-field
              autocomplete="off"
              v-model="provide_lodging"
              name="provide_lodging"
              label="供住"
              right-icon="video-o"
              @click-right-icon="rightClick"
              placeholder="请输入供住说明(选填)"
              type="textarea"
              rows="1"
              autosize
              :rules="[
                {
                  validator: value => {
                    return wordCountLimit(value, 500)
                  },
                  message: '供住说明长度不能超过500位'
                }
              ]"
            />
            <van-field
              autocomplete="off"
              v-model="housing_allowance"
              name="housing_allowance"
              label="住房补贴 / 房补"
              right-icon="video-o"
              @click-right-icon="rightClick"
              placeholder="请输入住房补贴说明(选填)"
              type="textarea"
              rows="1"
              autosize
              :rules="[
                {
                  validator: value => {
                    return wordCountLimit(value, 500)
                  },
                  message: '住房补贴说明长度不能超过500位'
                }
              ]"
            />
            <van-field
              autocomplete="off"
              v-model="housing_fund"
              name="housing_fund"
              label="住房公积金"
              right-icon="video-o"
              @click-right-icon="rightClick"
              placeholder="请输入住房公积金说明(选填)"
              type="textarea"
              rows="1"
              autosize
              :rules="[
                {
                  validator: value => {
                    return wordCountLimit(value, 500)
                  },
                  message: '住房公积金说明长度不能超过500位'
                }
              ]"
            />
            <van-field
              autocomplete="off"
              v-model="bonus"
              name="bonus"
              label="奖金"
              right-icon="video-o"
              @click-right-icon="rightClick"
              placeholder="请输入奖金说明(选填)"
              type="textarea"
              rows="1"
              autosize
              :rules="[
                {
                  validator: value => {
                    return wordCountLimit(value, 500)
                  },
                  message: '奖金说明长度不能超过500位'
                }
              ]"
            />
            <van-field
              autocomplete="off"
              v-model="communication_subsidy"
              name="communication_subsidy"
              label="通讯补助 / 话补"
              right-icon="video-o"
              @click-right-icon="rightClick"
              placeholder="请输入通讯补助说明(选填)"
              type="textarea"
              rows="1"
              autosize
              :rules="[
                {
                  validator: value => {
                    return wordCountLimit(value, 500)
                  },
                  message: '通讯补助说明长度不能超过500位'
                }
              ]"
            />
            <van-field
              autocomplete="off"
              v-model="transport_allowance"
              name="transport_allowance"
              label="交通补助 / 车补"
              right-icon="video-o"
              @click-right-icon="rightClick"
              placeholder="请输入交通补助说明(选填)"
              type="textarea"
              rows="1"
              autosize
              :rules="[
                {
                  validator: value => {
                    return wordCountLimit(value, 500)
                  },
                  message: '交通补助说明长度不能超过500位'
                }
              ]"
            /> -->

            <!-- <van-field
              autocomplete="off"
              v-model="other_benefits"
              name="other_benefits"
              label="其他福利"
              right-icon="video-o"
              @click-right-icon="rightClick"
              type="textarea"
              rows="1"
              autosize
              placeholder="请输入其他福利(选填)"
              :rules="[
                {
                  validator: value => {
                    return wordCountLimit(value, 500)
                  },
                  message: '其他福利长度不能超过500位'
                }
              ]"
            /> -->
          </div>
        </van-tab>
        <van-tab title="录用条件">
          <div>
            <van-divider
              :style="{
                color: '#020202',
                borderColor: '#DD4F42',
                padding: '10px 100px 0',
                margin: '0'
              }"
            >录用条件</van-divider>
            <!-- <van-field
              autocomplete="off"
              v-model="age"
              name="age"
              label="年龄"
              right-icon="video-o"
              @click-right-icon="rightClick"
              placeholder="请输入年龄要求, 如18(选填)"
              :rules="[
                {
                  validator: value => {
                    return wordCountLimit(value, 3)
                  },
                  message: '年龄要求长度不能超过3位'
                }
              ]"
            />
            <van-field
              autocomplete="off"
              v-model="height"
              name="height"
              label="身高"
              right-icon="video-o"
              @click-right-icon="rightClick"
              placeholder="请输入身高要求, 如170(选填)"
              :rules="[
                {
                  validator: value => {
                    return wordCountLimit(value, 3)
                  },
                  message: '身高要求长度不能超过3位'
                }
              ]"
            />
            <van-field
              autocomplete="off"
              v-model="vision"
              name="vision"
              label="视力"
              right-icon="video-o"
              @click-right-icon="rightClick"
              placeholder="请输入视力要求(选填)"
              type="textarea"
              rows="1"
              autosize
              :rules="[
                {
                  validator: value => {
                    return wordCountLimit(value, 500)
                  },
                  message: '视力要求长度不能超过500位'
                }
              ]"
            /> -->
            <!-- 学历  -->
            <div class="greentext">
            <van-field
              autocomplete="off"
              name="educations"
              label="学历(多选)"
              v-if="educationsList.length"
            >
              <template #input>
                <van-checkbox-group
                  v-model="educations"
                  direction="horizontal"
                  style="margin-bottom: -10px"
                >
                  <van-checkbox
                    v-for="item in educationsList"
                    :name="item.key"
                    shape="square"
                    :key="item.key"
                    style="margin-bottom: 10px"
                  >{{ item.value }}</van-checkbox>
                </van-checkbox-group>
              </template>
            </van-field>
          </div>
            <!--  工作经验  -->
            <div class="greentext">
            <van-field
              autocomplete="off"
              name="working_lifes_id"
              label="工作经验"
              v-if="workinglifesIdList.length"
            >
              <template #input>
                <van-radio-group
                  v-model="working_lifes_id"
                  direction="horizontal"
                  style="margin-bottom: -10px"
                >
                  <van-radio
                    v-for="item in workinglifesIdList"
                    :name="item.key"
                    :key="item.key"
                    style="margin-bottom: 10px"
                  >{{ item.value }}</van-radio>
                </van-radio-group>
              </template>
            </van-field>
          </div>
            <!-- 证件类型  -->
            <div class="greentext">
            <van-field
              autocomplete="off"
              name="certificate_types"
              label="证件类型(多选)"
              v-if="certificateTypesList.length"
            >
              <template #input>
                <van-checkbox-group
                  v-model="certificate_types"
                  direction="horizontal"
                  style="margin-bottom: -10px"
                >
                  <van-checkbox
                    v-for="item in certificateTypesList"
                    :name="item.key"
                    shape="square"
                    :key="item.key"
                    style="margin-bottom: 10px"
                  >{{ item.value }}</van-checkbox>
                </van-checkbox-group>
              </template>
            </van-field>
          </div>
            <!-- <van-field
              autocomplete="off"
              v-model="male_to_female_ratio"
              name="male_to_female_ratio"
              label="男女比例"
              right-icon="video-o"
              @click-right-icon="rightClick"
              placeholder="请输入(选填)"
              type="textarea"
              rows="1"
              autosize
              :rules="[
                {
                  validator: value => {
                    return wordCountLimit(value, 500)
                  },
                  message: '男女比例长度不能超过500位'
                }
              ]"
            />
            <van-field
              autocomplete="off"
              v-model="not_nationality"
              name="not_nationality"
              label="已招满的民族"
              right-icon="video-o"
              @click-right-icon="rightClick"
              placeholder="请输入(选填)"
              type="textarea"
              rows="1"
              autosize
              :rules="[
                {
                  validator: value => {
                    return wordCountLimit(value, 500)
                  },
                  message: '已招满的民族说明长度不能超过500位'
                }
              ]"
            />
            <van-field
              autocomplete="off"
              v-model="not_area"
              name="not_area"
              label="已招满的地区"
              right-icon="video-o"
              @click-right-icon="rightClick"
              placeholder="请输入(选填)"
              type="textarea"
              rows="1"
              autosize
              :rules="[
                {
                  validator: value => {
                    return wordCountLimit(value, 500)
                  },
                  message: '已招满的地区说明长度不能超过500位'
                }
              ]"
            />
            <van-field
              autocomplete="off"
              v-model="medical_examination"
              name="medical_examination"
              label="体检说明"
              right-icon="video-o"
              @click-right-icon="rightClick"
              placeholder="请输入(选填)"
              type="textarea"
              rows="1"
              autosize
              :rules="[
                {
                  validator: value => {
                    return wordCountLimit(value, 500)
                  },
                  message: '体检说明长度不能超过500位'
                }
              ]"
            />
            <van-field
              autocomplete="off"
              v-model="hair_style"
              name="hair_style"
              label="发型要求"
              right-icon="video-o"
              @click-right-icon="rightClick"
              placeholder="请输入(选填)"
              type="textarea"
              rows="1"
              autosize
              :rules="[
                {
                  validator: value => {
                    return wordCountLimit(value, 500)
                  },
                  message: '发型要求长度不能超过500位'
                }
              ]"
            />
            <van-field
              autocomplete="off"
              v-model="tattoo_state"
              name="tattoo_state"
              label="纹身要求"
              right-icon="video-o"
              @click-right-icon="rightClick"
              placeholder="请输入(选填)"
              type="textarea"
              rows="1"
              autosize
              :rules="[
                {
                  validator: value => {
                    return wordCountLimit(value, 500)
                  },
                  message: '纹身要求长度不能超过500位'
                }
              ]"
            />
            <van-field
              autocomplete="off"
              v-model="tips"
              name="tips"
              label="温馨提示"
              right-icon="video-o"
              @click-right-icon="rightClick"
              type="textarea"
              rows="1"
              autosize
              placeholder="请输入其他要求"
              :rules="[
                {
                  validator: value => {
                    return wordCountLimit(value, 500)
                  },
                  message: '温馨提示内容长度不能超过500位'
                }
              ]"
            /> -->
          </div>
        </van-tab>
        <!-- <van-tab title="入职材料">
          <div>
            <van-divider
              :style="{
                color: '#020202',
                borderColor: '#DD4F42',
                padding: '10px 100px 0',
                margin: '0'
              }"
            >入职材料</van-divider>
            <van-field
              autocomplete="off"
              type="number"
              v-model="id_card_num"
              name="id_card_num"
              label="身份证复印件数量"
              right-icon="video-o"
              @click-right-icon="rightClick"
              placeholder="请输入身份证复印件数量(选填)"
            />
            <van-field
              autocomplete="off"
              type="number"
              v-model="bank_card_num"
              name="bank_card_num"
              label="银行卡复印件数量"
              right-icon="video-o"
              @click-right-icon="rightClick"
              placeholder="请输入银行卡复印件数量(选填)"
            />
            <van-field
              autocomplete="off"
              v-model="photo_color_size_quantity"
              name="photo_color_size_quantity"
              label="照片颜色尺寸和数量"
              right-icon="video-o"
              @click-right-icon="rightClick"
              placeholder="请输入照片颜色尺寸和数量(选填)"
              type="textarea"
              rows="1"
              autosize
              :rules="[
                {
                  validator: value => {
                    return wordCountLimit(value, 500)
                  },
                  message: '照片颜色尺寸和数量说明长度不能超过500位'
                }
              ]"
            />
            <van-field
              autocomplete="off"
              v-model="personal_bags"
              name="personal_bags"
              label="随身行李"
              right-icon="video-o"
              @click-right-icon="rightClick"
              placeholder="请输入随身行李(选填)"
              type="textarea"
              rows="1"
              autosize
              :rules="[
                {
                  validator: value => {
                    return wordCountLimit(value, 500)
                  },
                  message: '随身行李说明长度不能超过500位'
                }
              ]"
            />
            <van-field
              autocomplete="off"
              type="number"
              v-model="medical_examinationFee"
              name="medical_examinationFee"
              label="体检费"
              right-icon="video-o"
              @click-right-icon="rightClick"
              placeholder="请输入(选填)"
              :rules="[
                {
                  validator: value => {
                    return wordCountLimit(value, 20)
                  },
                  message: '体检费说明长度不能超过20位'
                }
              ]"
            />
            <van-field
              autocomplete="off"
              v-model="other_materials"
              name="other_materials"
              label="其他材料"
              right-icon="video-o"
              @click-right-icon="rightClick"
              type="textarea"
              rows="1"
              autosize
              placeholder="请输入其他材料"
              :rules="[
                {
                  validator: value => {
                    return wordCountLimit(value, 500)
                  },
                  message: '其他材料说明长度不能超过500位'
                }
              ]"
            />
          </div>
        </van-tab> -->
        <van-tab title="定位与时间">
          <div>
            <van-divider
              :style="{
                color: '#020202',
                borderColor: '#DD4F42',
                padding: '10px 100px 0',
                margin: '0'
              }"
            >定位与时间</van-divider>
            <div class="redtext">
            <van-field
              autocomplete="off"
              v-model="contact"
              name="contact"
              label="联系人"
              placeholder="请输入联系人(必填)"
              type="textarea"
              rows="1"
              autosize
              required
              :rules="[
                {required: true, message: '请填写联系人'},
              ]"
            />
          </div>
          <div class="redtext">
            <van-field
              autocomplete="off"
              v-model="phone"
              name="phone"
              label="手机号"
              required
              placeholder="请输入手机号(必填)"
              :rules="[
                {required: true, message: '请填写手机号'},
              ]"
            />
        </div>
        <div class="redtext">
            <van-field
              autocomplete="off"
              style="display:flex;align-items: center;"
              name="addressValue"
              label="面试详细地址"
            >
              <template #label>
                <p class="redtext" @click="savelocal('addressValue')">面试详细地址<br>保存面试地址</p>
              </template>
              <template #input>
                <van-search v-model="addressValue"
                    id="addressInput"
                    placeholder="请输入面试详细地址"
                    @search="onSearchAddress"
                    style="padding:0;width:100%"
                    class="search_content"
                    background="#FFF">
                </van-search>
              </template>
            </van-field>
           </div>
           <div class="redtext">
            <van-field
              autocomplete="off"
              style="display:flex;align-items: center;"
              name="addressJobValue"
              label="上班详细地址"
            >
            <template #label>
              <p class="redtext" @click="savelocal('addressJobValue')">上班详细地址<br>保存上班地址</p>
            </template>
              <template #input>
                <van-search v-model="addressJobValue"
                    id="addressJobInput"
                    placeholder="请输入上班详细地址"
                    @search="onSearchJobAddress"
                    style="padding:0;width:100%"
                    class="search_content"
                    background="#FFF">
                </van-search>
              </template>
            </van-field>
            </div>
            <!-- <van-field
              autocomplete="off"
              v-model="wx_num"
              name="wx_num"
              label="微信号"
              right-icon="video-o"
              @click-right-icon="rightClick"
              placeholder="请输入(必填)"
              :rules="[
                {
                  validator: value => {
                    return wordCountLimit(value, 20)
                  },
                  message: '微信号长度不能超过20位'
                }
              ]"
            />
            <van-field
              autocomplete="off"
              v-model="qq_num"
              name="qq_num"
              label="QQ号"
              right-icon="video-o"
              @click-right-icon="rightClick"
              placeholder="请输入(选填)"
              :rules="[
                {
                  validator: value => {
                    return wordCountLimit(value, 20)
                  },
                  message: 'QQ号长度不能超过20位'
                }
              ]"
            /> -->

            <!-- 面试地址   -->
            <!-- <com-full-address
              :showFullAddressObj="showFullAddressObj_interview"
              :keyWord="'interview'"
              :frontLabel="'面试'"
              @getFullAddressValue="handNeedFullAddressValue_publish"
              @updateRegionFourName="toUpdateRegionFourName"
              @updateDetailAddress="toUpdateDetailAddress"
              :disabled="false"
              :isUpdate="true"
            ></com-full-address> -->

            <!-- <van-field
              autocomplete="off"
              v-model="application_time"
              name="application_time"
              label="面试 / 应聘时间"
              right-icon="video-o"
              @click-right-icon="rightClick"
              placeholder="请输入"
              type="textarea"
              rows="1"
              autosize
              :rules="[
                {
                  validator: value => {
                    return wordCountLimit(value, 500)
                  },
                  message: '面试时间长度不能超过500位'
                }
              ]"
            /> -->

            <!-- 上班地址   -->
            <!-- <com-full-address
              :showFullAddressObj="showFullAddressObj_work"
              :keyWord="'work'"
              :frontLabel="'上班'"
              @getFullAddressValue="handNeedFullAddressValue_publish"
              @updateRegionFourName="toUpdateRegionFourName"
              @updateDetailAddress="toUpdateDetailAddress"
              :disabled="false"
              :isUpdate="true"
            ></com-full-address> -->

            <!-- <van-field
              autocomplete="off"
              v-model="car_fare_reimbursement"
              name="car_fare_reimbursement"
              label="车费报销"
              right-icon="video-o"
              @click-right-icon="rightClick"
              placeholder="请输入(选填)"
              type="textarea"
              rows="1"
              autosize
              :rules="[
                {
                  validator: value => {
                    return wordCountLimit(value, 500)
                  },
                  message: '车费报销长度不能超过500位'
                }
              ]"
            /> -->

            <van-field
              autocomplete="off"
              type="number"
              v-model="generation_of_commission"
              name="generation_of_commission"
              center
              clearable
              label="代招费"
              right-icon="video-o"
              @click-right-icon="rightClick"
              placeholder="请输入代招费"

            >
              <template #extra>
                <!-- 选择器   -->
                <select
                  style="height: 23px;position:absolute;right:1rem;"
                  name="fee_unit"
                  v-model="fee_unit"
                >
                  <option
                    v-for="(item, index) in feeUnitList"
                    :value="item.id"
                    :key="index"
                  >{{ item.value }}</option>
                </select>
              </template>
            </van-field>
            <van-field
              autocomplete="off"
              v-model="generation_instructions"
              name="generation_instructions"
              label="代招说明"
              right-icon="video-o"
              @click-right-icon="rightClick"
              placeholder="请输入(选填)"
              type="textarea"
              rows="1"
              autosize
              :rules="[
                {
                  validator: value => {
                    return wordCountLimit(value, 500)
                  },
                  message: '代招说明长度不能超过500位'
                }
              ]"
            />

            <van-field
              autocomplete="off"
              type="number"
              v-model="downstream_cooperation_fee"
              name="downstream_cooperation_fee"
              center
              clearable
              label="下游合作费"
              right-icon="video-o"
              @click-right-icon="rightClick"
              placeholder="请输入下游合作费"
            >
              <template #extra>
                <!-- 选择器   -->
                <select
                  style="height: 23px;position:absolute;right:1rem;"
                  name="fee_unit"
                  v-model="cooperation_fee_unit"
                >
                  <option
                    v-for="(item, index) in feeUnitList"
                    :value="item.id"
                    :key="index"
                  >{{ item.value }}</option>
                </select>
              </template>
            </van-field>

            <van-field
              autocomplete="off"
              v-model="downstream_cooperation_fee_desc"
              name="downstream_cooperation_fee_desc"
              label="下游合作费说明"
              right-icon="video-o"
              @click-right-icon="rightClick"
              placeholder="请输入(选填)"
              type="textarea"
              rows="1"
              autosize
              :rules="[
                {
                  validator: value => {
                    return wordCountLimit(value, 500)
                  },
                  message: '下游合作费说明长度不能超过500位'
                }
              ]"
            />
          </div>
        </van-tab>

        <van-tab title="上游备注">
          <div>
            <van-divider
              :style="{
                color: '#020202',
                borderColor: '#DD4F42',
                padding: '10px 20px 0',
                margin: '0'
              }"
            >上游招聘信息备注（仅自己可见）</van-divider>
            <div class="redtext">
            <van-field
              autocomplete="off"
              style="align-items: center;"
              v-model="job_notes"
              name="job_notes"
              right-icon="video-o"
              @click-right-icon="rightClick"
              placeholder="请输入文字备注"
              type="textarea"
              rows="3"
              autosize
              :rules="[
                {
                  validator: value => {
                    return wordCountLimit(value, 500)
                  },
                  message: '文字备注不能超过500位'
                }
              ]"
            >
            <template #label>
              <p class="redtext" @click="savelocal('job_notes')">
                文字备注</br>
               保存备注</p>
             </template>
            </van-field>
            </div>
            <van-field
              autocomplete="off"
              name="job_notes_photos"
              label="图片备注"
              right-icon="video-o"
              @click-right-icon="rightClick"
            >
              <template #input>
                <van-uploader
                  v-model="job_notes_photos"
                  :preview-options="{
                    closeable: true
                  }"
                  :max-count="9"
                  :after-read="uploadPhotoList_ForNote"
                  @delete="toDeleteAnyPreviewPhoto_ForNote"
                  :deletable="
                    (jobDetailInfo && jobDetailInfo.status == 2) ||
                      ['publishJob', 'canShare', 'jobSheet'].includes(keyword)
                  "
                  :show-upload="
                    (jobDetailInfo && jobDetailInfo.status == 2) ||
                      ['publishJob', 'canShare', 'jobSheet'].includes(keyword)
                  "
                />
              </template>
            </van-field>

            <van-field
              autocomplete="off"
              name="job_notes_video"
              label="视频备注"
              right-icon="video-o"
              @click-right-icon="rightClick"
              class="videosNote"
            >
              <template #input>
                <van-uploader
                  upload-text="只能上传MP4格式的视频"
                  accept="video/*"
                  v-model="job_notes_video"
                  @click-preview="previewVideos"
                  :max-count="9"
                  :after-read="uploadPhotoList_ForNoteVideo"
                  @delete="toDeleteAnyPreviewPhoto_ForNoteVideo"
                  :deletable="
                    (jobDetailInfo && jobDetailInfo.status == 2) ||
                      ['publishJob', 'canShare', 'jobSheet'].includes(keyword)
                  "
                  :show-upload="
                    (jobDetailInfo && jobDetailInfo.status == 2) ||
                      ['publishJob', 'canShare', 'jobSheet'].includes(keyword)
                  "
                >
                  <template #preview-cover>
                    <van-image width="80" height="80" :src="videoIcon" />
                  </template>
                </van-uploader>
              </template>
            </van-field>
          </div>
        </van-tab>

        <div style="margin: 16px">
          <van-button
            v-show="true"
            round
            block
            :type="actionType === 'addInfo' ? 'info' : 'warning'"
            :native-type="submitBtnType"
            :loading="submitBtnLoading"
          >{{ actionType === 'addInfo' ? '提交' : '修改后提交' }}</van-button>
        </div>
      </van-form>
    </van-tabs>

    <!-- 视频、播放预览组件   -->
    <com-video-preview></com-video-preview>
  </div>
</template>

<script>
import SalaryInfo from '@/constants/salaryinfo.js';
import KeyWords from '@/views/allTypeJobs/allTypeJobss.js';
import {videoObj} from '@/utils/videoLinkObj.js'
import {Toast, Dialog} from 'vant'
import {mapGetters, mapState} from 'vuex'
import {payMoneyMode} from '../../constants/payMoneyMode'
import payMoneyModeName from '../../constants/payMoneyModeName'
import classAttributeIdList from '../../constants/classAttributeIdList'
import positionIdList from '../../constants/positionIdList'
import paydayIdList from '../../constants/paydayIdList'
import workinglifesIdList from '../../constants/workinglifesIdList'
import certificateTypesList from '../../constants/certificateTypesList'
import educationsList from '../../constants/educationsList'
import materialList from '../../constants/materialList'
import feeUnitList from '../../constants/feeUnitList'
import {jobTypeArr} from '../../constants/comUtils'

import allTypesPayDay from '../../components/allTypesPayDay'

import comFullAddressTwo from './comFullAddressTwo'

import {cosUploadImg} from '@/utils/cosUpload.js'

import videoIcon from '../../assets/videoIcon.png'

import comVideoPreview from '../../components/comVideoPreview'
import quillEditor from '../../components/quillEditor'
export default {
  name: 'infoForm',
  props: {
    jobTypeId: String,
    btnShow:{
      type: Boolean,
      default:false,
      // 不是必传
      required: false
    },
    jobDetailInfo: Object,
    keyword: String,
    // 父job_id用于转发，自身的job_id用于提交修改。
    parentOrSelfJobId: {
      type: String,
      // 不是必传
      required: false
    },

    auditShareStatus: Number,
    actionType: String
  },
  components: {
    allTypesPayDay,
    comFullAddress: comFullAddressTwo,
    comVideoPreview,
    quillEditor
  },

  data() {
    return {
      addressValue:'',
      addressJobValue:'',
      work_address:{},
      interview_address:{},
      interview_lat:'',
      interview_long:'',
      work_lat:'',
      work_long:'',
      videoIcon,
      // 提交按钮的类型
      submitBtnType: 'submit',
      submitBtnLoading: false,
      // 定义地理位置的初始状态
      interviewRegions: {
        provinceid: '',
        provincename: '',
        cityid: '',
        cityname: '',
        areaid: '',
        areaname: '',
        streetid: '',
        streetname: '',
        villageid: '',
        villagename: '',
        address: '',
        FulleAddress: '',
        long: '',
        lat: ''
      },
      // 定义地理位置的初始状态默认
      workRegions: {
        provinceid: '',
        provincename: '',
        cityid: '',
        cityname: '',
        areaid: '',
        areaname: '',
        streetid: '',
        streetname: '',
        villageid: '',
        villagename: '',
        address: '',
        FulleAddress: '',
        long: '',
        lat: ''
      },

      showFullAddressObj_interview: {
        region_four_name: '',
        detail_address: ''
      },
      showFullAddressObj_work: {
        region_four_name: '',
        detail_address: ''
      },
      pattern_generation: /^[0-9]+(\.[0-9]{0,2})?$/,
      active: 0,
      /*
       * 基础信息
       */

      // 转发或者发布
      job_category_id: '',
      // 公司的id
      jobTypeList: jobTypeArr,

      enterprise_name: '',
      // 招聘信息
      recruiting_position: '',
      // 招聘人数
      recruiting_numbers: '',
      // 工作时间
      work_days: '',
      // 休息日说明
      res_days: '',
      // 职位属性
      position_id: '',
      position_ids: [],
      // positionIdList: [],
      positionIdList,
      // 班制属性
      class_attribute_id: '',
      class_attribute_ids: [],
      // classAttributeIdList: [],
      classAttributeIdList,
      job_content: '',
      job_environment: '',
      // 矿工说明
      completion_instructions: '',
      // 自离说明
      self_explanation: '',
      // 辞职说明
      resignation_instructions: '',
      other_description: '',

      photos: [],
      // 多个图片
      photos_list_url: [],

      job_videos: [],
      job_videos_url: [],

      /*
       * 薪资福利
       */
      // 算薪方式
      pay_money_mode: '',
      // 算薪方式的名称（底薪、纯工价、同工同酬....）
      pay_mode_name: '',
      payMoneyModeList: payMoneyMode,
      payMoneyModeName,

      // 第一个、第二个、第三个输入的值
      first_value_input: '',
      second_value_input: '',
      third_value_input: '',

      // 仅仅用于占位，数值不起任何作用
      comprehensive_salary_range: '100-200',
      // 最小综合工资
      min_comprehensive_salary: '',
      // 最大综合工资
      max_comprehensive_salary: '',
      // 综合工资范围: 如: 4000 - 5000
      comprehensive_salary: '',
      // 薪资说明
      salary_description: '',
      payday_id: '',
      payday_ids: [],
      payday_mode_name: '',
      paydayIdList,
      // paydayList: [],

      // 包吃
      free_food: '',
      // 供吃
      provide_food: '',
      // 饭补
      food_allowance: '',
      // 社保
      social_security: '',
      // 保险
      insurance: '',
      // 包住
      encase: '',
      // 供住
      provide_lodging: '',
      // 住房补贴(房补)
      housing_allowance: '',
      // 住房公积金
      housing_fund: '',
      // 奖金
      bonus: '',
      // 通信补助(话补)
      communication_subsidy: '',
      // 交通补助
      transport_allowance: '',
      IsWithPhone: '',
      IsWithPhones: [],
      IsWearCleanClothes: '',
      IsWearCleanClothess: [],
      // 其他福利
      other_benefits: [],

      /*
       * 录用条件
       */
      age: '',
      height: '',
      // 视力
      vision: '',
      visions: [],
      // 学历, 多选
      educations: [],
      // 学历列表
      educationsList,
      materialList,
      // 工作经验
      working_lifes_id: '',
      workinglifesIdList,
      // workinglifesIdList: [],
      // 证件类型
      certificate_types: [],
      certificateTypesList,
      male_to_female_ratio: '',
      // 已招满的民族
      not_nationality: '',
      // 已招满的地区
      not_area: '',
      // 体检说明要求
      medical_examination: '',
      // 发型要求
      hair_style: '',
      // 纹身状态
      tattoo_state: '',
      // 其他要求, 温馨提示
      tips: '',
      lend_money_amount: '',
      /*
       * 入职材料
       */
      id_card_num: '',
      bank_card_num: '',
      // 照片尺寸
      photo_color_size_quantity: '',
      // 体检费
      medical_examinationFee: '',
      personal_bags: '',
      other_materials: '',

      /*
       * 定位与时间
       */
      contact: '',
      phone: '',
      wx_num: '',
      qq_num: '',

      // 面试时间 或 应聘时间
      application_time: '',

      // 车费报销
      car_fare_reimbursement: '',
      // 代招说明
      generation_instructions: '',
      // 代招提成
      generation_of_commission: '',
      fee_unit: '',
      feeUnitList,
      // 下游合作费
      downstream_cooperation_fee: '',
      cooperation_fee_unit: '',
      downstream_cooperation_fee_desc: '',

      /*
       *
       * 招聘信息备注
       *
       * */
      job_notes: '',
      job_notes_photos: [],
      job_notes_photos_url: [],

      job_notes_video: [],
      job_notes_video_url: []
    }
  },

  created() {
    //如果没有这句代码，select中初始化会是空白的，默认选中就无法实现
    this.fee_unit = this.feeUnitList[0].id
    this.cooperation_fee_unit = this.feeUnitList[0].id
  },

  mounted() {
    // 初始化地址搜索工具
    this.mapSearchInit();
    this.mapSearchJobInit();
    this.set_contact_info();
    /*
     * 核心： 使用ref="formBox"中的getValues()方法
     *
     * */
    // console.log('实例对象-----getValues()方法', this.$refs.formFieldBox.getValues());
    // 只有时addInfo 才实时保存草稿
    /*if (this.actionType === 'addInfo'){
      this.timerId = setInterval(() => {
        // todo 实现草稿箱功能  2022年4月8日23:02:48 已完成
        // 获取表单的全部值
        const values =  this.$refs.formFieldBox.getValues();
        console.log('表单数值', values);
        const formVal_draft = this._getNeedFieldVal(values);
        console.warn('1秒----不断实时执行-----拼接后的参数(后端需要的字段)----草稿值', formVal_draft);
        localStorage.setItem('draft_publish_info', JSON.stringify(formVal_draft));
      }, 1000);
    };*/
  },

  beforeDestroy() {
    // 清除循环定时器
    clearInterval(this.timerId)
  },

  watch: {
    // 监视
    // 谨慎使用监视, 坑太多
    jobDetailInfo: {
      deep: true,
      handler(newValue, oldVal) {
        if (JSON.stringify(newValue) != '{}') {
          // 只有是审核时候， 按钮的状态才变化 deletable
          // todo 解释： 由于每个form表单项没有加上disabled、或readonly、亦或者deletable属性。则这段代码不生效。暂时保留吧
          if (this.keyword === 'auditState') {
            if (newValue.status == 2) {
              // 验证审核失败时
              this.deletable = true
              this.isUpdate = true
            } else {
              this.deletable = false
              this.isUpdate = false
            }
          }
          // 此段代码不要动！！！ 这是为了渲染出Dom。
          this.min_comprehensive_salary = '233333333'
          console.log('newValue')
          console.log(newValue)
          console.log('newValue')
          // form表单中的值
          // todo 需要和后端商量这个字段
          this.addressValue = newValue.interview_address_fulle_address || newValue.interview_address.FulleAddress
          this.addressJobValue = newValue.work_address_fulle_address || newValue.work_address.FulleAddress
          this.job_category_id = newValue.job_category_id

          this.enterprise_name = newValue.enterprise_name
          this.recruiting_position = newValue.recruiting_position
          this.recruiting_numbers = newValue.recruiting_numbers*1 > 0 ? newValue.recruiting_numbers*1 : ''
          this.work_days = newValue.work_days
          this.res_days = newValue.res_days
          this.position_ids = newValue.position_id?newValue.position_id.split(','):[];
          this.class_attribute_ids = newValue.class_attribute_id?newValue.class_attribute_id.split(','):[];
          this.job_content = newValue.job_content
          this.job_environment = newValue.job_environment
          this.completion_instructions = newValue.completion_instruction_description
          this.self_explanation = newValue.self_explanation_description
          this.resignation_instructions = newValue.resignation_instructions_description
          this.other_description = newValue.other_description

          // 这是由于van-uploader组件渲染时， 执行了delete方法。因此使用this.$nextTick。dom渲染完后，再执行和更新状态。
          this.$nextTick(() => {
            // 需要的图片链接地址
            this.photos =
              newValue.photos && newValue.photos.length
                ? newValue.photos.filter(item => Boolean(item)).map(item => ({url: item}))
                : []

            this.job_notes_photos =
              newValue.notes_photos && newValue.notes_photos.length
                ? newValue.notes_photos.split('|').map(item => ({url: item}))
                : []
            // 视频备注
            this.job_notes_video =
              newValue.notes_videos && newValue.notes_videos.length
                ? newValue.notes_videos.split('|').map(item => ({url: item}))
                : []
            // 上传视频
            this.job_videos =
              newValue.videos && newValue.videos.length ? newValue.videos.split('|').map(item => ({url: item})) : []

            this.first_value_input = newValue.first_value_input
            this.second_value_input = newValue.second_value_input
            this.third_value_input = newValue.third_value_input
            this.min_comprehensive_salary = newValue.min_comprehensive_salary
            this.max_comprehensive_salary = newValue.max_comprehensive_salary

            this.comprehensive_salary_range =
              newValue.min_comprehensive_salary + '-' + newValue.max_comprehensive_salary
          })

          // 工作环境
          this.photos_list_url =
            newValue.photos && newValue.photos.length ? newValue.photos.filter(item => Boolean(item)) : []
          // 图片备注
          this.job_notes_photos_url =
            newValue.notes_photos && newValue.notes_photos.length ? newValue.notes_photos.split('|') : []
          this.job_notes_video_url =
            newValue.notes_videos && newValue.notes_videos.length ? newValue.notes_videos.split('|') : []

          this.job_videos_url = newValue.videos && newValue.videos.length ? newValue.videos.split('|') : []

          this.pay_money_mode = newValue.payway_id

          this.salary_description = newValue.salary_remark
          this.lend_money_amount = newValue.lend_money_amount
          // 发薪日
          this.payday_id = newValue.payday
          // 具体的发薪日
          this.payday_mode_name = newValue.pay_money_detail_date

          // 包吃
          this.free_food = newValue.free_food
          // 供吃
          this.provide_food = newValue.provide_food
          // 饭补
          this.food_allowance = newValue.food_allowance
          // 社保
          this.social_security = newValue.social_security
          // 保险
          this.insurance = newValue.insurance
          // 包住
          this.encase = newValue.encase
          // 供住
          this.provide_lodging = newValue.provide_lodging
          // 住房补贴(房补)
          this.housing_allowance = newValue.housing_allowance
          // 住房公积金
          this.housing_fund = newValue.housing_fund
          // 奖金
          this.bonus = newValue.bonus
          // 通信补助(话补)
          this.communication_subsidy = newValue.communication_subsidy
          // 交通补助
          this.transport_allowance = newValue.transport_allowance
          this.IsWithphones = newValue.IsWithphone?newValue.IsWithphone.split(','):[];
          this.IsWearCleanClothess = newValue.IsWearCleanClothes?newValue.IsWearCleanClothes.split(','):[];
          // 福利
          this.other_benefits = newValue.other_benefits

          this.age = newValue.age
          this.height = newValue.height
          // 视力
          this.visions = newValue.vision?newValue.vision.split(','):[];
          // 学历, 多选
          this.educations = newValue.educations

          // 工作经验
          this.working_lifes_id = newValue.working_lifes_id

          // 证件类型
          this.certificate_types = newValue.certificate_type
          this.male_to_female_ratio = newValue.male_to_female_ratio
          // 已招满的民族
          this.not_nationality = newValue.not_nationality
          // 已招满的地区
          this.not_area = newValue.not_area
          // 体检说明要求
          this.medical_examination = newValue.medical_examination
          // 发型要求
          this.hair_style = newValue.hair_style
          // 纹身状态
          this.tattoo_state = newValue.tattoo_state
          // 其他要求, 温馨提示
          this.tips = newValue.tips

          this.id_card_num = newValue.id_card_num
          this.bank_card_num = newValue.bank_card_num
          // 照片尺寸
          this.photo_color_size_quantity = newValue.photo_color_size_quantity
          // 体检费
          this.medical_examinationFee = newValue.medical_examination_fee
          this.personal_bags = newValue.personal_bags
          this.other_materials = newValue.other_materials

          /*
           * 定位与时间
           */
          this.contact = newValue.contact
          this.phone = newValue.phone
          this.wx_num = newValue.wechat
          this.qq_num = newValue.qq
          // 面试时间 或 应聘时间
          this.application_time = newValue.application_time
          // 车费报销
          this.car_fare_reimbursement = newValue.car_fare_reimbursement
          // 代招说明
          this.generation_instructions = newValue.generation_instructions
          // 代招提成
          this.generation_of_commission = newValue.generation_of_commission
          this.fee_unit = newValue.fee_unit
          // 下游合作费
          this.downstream_cooperation_fee = newValue.downstream_cooperation_fee
          this.cooperation_fee_unit = newValue.cooperation_fee_unit
          this.downstream_cooperation_fee_desc = newValue.downstream_cooperation_fee_desc

          this.job_notes = newValue.job_notes

          // todo 对位置的数据格式进行拼接、还有照片的数据进行拼接
          this.showFullAddressObj_interview = {
            region_four_name:
              (newValue.interview_address_province_name +
              newValue.interview_address_city_name +
              newValue.interview_address_area_name + newValue.interview_address_street_name) || '',
            detail_address: newValue.interview_address_address || '',
          }
          this.showFullAddressObj_work = {
            region_four_name:
              (newValue.work_address_province_name +
              newValue.work_address_city_name +
              newValue.work_address_area_name + newValue.work_address_street_name) || '',
            detail_address: newValue.work_address_address || '',
          }

          // 面试的地理信息
          this.interviewRegions = {
            provinceid: newValue.interview_address_province_id,
            provincename: newValue.interview_address_province_name,
            cityid: newValue.interview_address_city_id,
            cityname: newValue.interview_address_city_name,
            areaid: newValue.interview_address_area_id,
            areaname: newValue.interview_address_area_name,
            streetid: newValue.interview_address_street_id,
            streetname: newValue.interview_address_street_name,
            villageid: '',
            villagename: '',
            address: newValue.interview_address_address,
            FulleAddress: newValue.interview_address_fulle_address,
            long: newValue.interview_address_lng,
            lat: newValue.interview_address_lat
          }
          // 工作的地理信息
          this.workRegions = {
            provinceid: newValue.work_address_province_id,
            provincename: newValue.work_address_province_name,
            cityid: newValue.work_address_city_id,
            cityname: newValue.work_address_city_name,
            areaid: newValue.work_address_area_id,
            areaname: newValue.work_address_area_name,
            streetid: newValue.work_address_street_id,
            streetname: newValue.work_address_street_name,
            villageid: '',
            villagename: '',
            address: newValue.work_address_address,
            FulleAddress: newValue.work_address_fulle_address,
            long: newValue.work_address_lng,
            lat: newValue.work_address_lat
          }
        }
      }
    }
  },

  methods: {
    chDataRes(type){
      let {job_notes,lend_money_amount,recruiting_position,addressValue,addressJobValue,contact,phone}=this.jobDetailInfo
      const contactinfo = localStorage.getItem('contactinfo');
      let obj = JSON.parse(contactinfo);
      if(type=='source'){
        this.job_notes = job_notes||'';
        this.lend_money_amount = lend_money_amount||'';
        this.recruiting_position= recruiting_position||'';
        this.addressValue= addressValue||'';
        this.addressJobValue= addressJobValue||'';
        this.contact = contact||'';
        this.phone = phone||'';
      }else if(type=='save'){
        this.job_notes = obj.job_notes||'';
        this.lend_money_amount = obj.lend_money_amount||'';
        this.recruiting_position= obj.recruiting_position||'';
        this.addressValue= obj.addressValue||'';
        this.addressJobValue= obj.addressJobValue||'';
        this.contact = obj.contact||'';
        this.phone = obj.phone||'';
      }
      console.log('chDataRes',type)
    },
    savelocal(field){
      const contactinfo = localStorage.getItem('contactinfo');
      let obj = JSON.parse(contactinfo);
      localStorage.setItem("contactinfo",JSON.stringify({...obj,[field]:this[field]}));
      Toast('保存成功');
    },
    /** 初始化地址搜索工具 */
    mapSearchInit() {
      const self = this
      // 绑定自动提示
      AMap.plugin(['AMap.Autocomplete', 'AMap.PlaceSearch'], function () {
        var autoOptions = {
          input: 'addressInput', //值为界面上input空间id
          city: self.currentCityName
        }
        var autoCompleteComponent = new AMap.Autocomplete(autoOptions)
        // 注册监听Autocomplete选中项
        AMap.event.addListener(autoCompleteComponent, 'select', function (data) {
          console.log('注册监听Autocomplete选中项', data)
          self.addressValue = data.poi.name
          self.interview_lat = data.poi.location.lat
          self.interview_long = data.poi.location.lng
          // 如果选择的是城市，则没有 location 数据
          if (data.poi.location) {
            let lat = data.poi.location.lat // 纬度
            let lng = data.poi.location.lng // 经度
            //逆向地理编码
            AMap.plugin('AMap.Geocoder', function () {
              let geocoder = new AMap.Geocoder({})
              let lnglat = [lng, lat]
              geocoder.getAddress(lnglat, function (status, geoData) {
                if (status === 'complete' && geoData.info === 'OK') {
                  // result为对应的地理位置详细信息
                  console.log('获取选中地址的地理位置', geoData)
                  self.interviewRegions.FulleAddress = data.poi.name
                  self.interviewRegions.areaid = geoData.regeocode.addressComponent.adcode
                  self.interviewRegions.areaname = geoData.regeocode.addressComponent.district
                  self.interviewRegions.cityid = geoData.regeocode.addressComponent.adcode.substring(0,4)
                  self.interviewRegions.cityname = geoData.regeocode.addressComponent.city
                  self.interviewRegions.lat = data.poi.location.lat
                  self.interviewRegions.long = data.poi.location.lng
                  self.interviewRegions.provinceid = geoData.regeocode.addressComponent.adcode.substring(0,2)
                  self.interviewRegions.provincename = geoData.regeocode.addressComponent.province
                  self.interview_address = geoData
                  return
                }
                self.$router.push({
                  name: self.prePage,
                })
              })
            })
          } else {
            //正向地理编码
            AMap.plugin('AMap.Geocoder', function () {
              let geocoder = new AMap.Geocoder({
                // city 指定进行编码查询的城市，支持传入城市名、adcode 和 citycode
                city: '全国'
              })

              geocoder.getLocation(data.poi.name, function (status, geoData) {
                if (status === 'complete' && geoData.info === 'OK') {
                  // result为对应的地理位置详细信息
                  console.log('获取选中地址的地理位置', geoData)
                  self.interview_address = geoData
                  return
                }

                self.$router.push({
                  name: self.prePage,
                })
              })
            })
          }
        })

        self.autoCompleteComponent = autoCompleteComponent
        // 注册placeSearch组件
        self.placeSearchComponent = new AMap.PlaceSearch({
          // city 指定搜索所在城市，支持传入格式有：城市名、citycode和adcode
          city: self.currentCityName,
          extensions: 'all'
        })
      })
    },
    mapSearchJobInit() {
      const self = this
      // 绑定自动提示
      AMap.plugin(['AMap.Autocomplete', 'AMap.PlaceSearch'], function () {
        var autoOptions = {
          input: 'addressJobInput', //值为界面上input空间id
          city: self.currentCityName
        }
        var autoCompleteComponent = new AMap.Autocomplete(autoOptions)
        // 注册监听Autocomplete选中项
        AMap.event.addListener(autoCompleteComponent, 'select', function (data) {
          console.log('注册监听Autocomplete选中项', data)
          self.addressJobValue = data.poi.name
          self.work_lat = data.poi.location.lat
          self.work_long = data.poi.location.lng
          // 如果选择的是城市，则没有 location 数据
          if (data.poi.location) {
            let lat = data.poi.location.lat // 纬度
            let lng = data.poi.location.lng // 经度
            //逆向地理编码
            AMap.plugin('AMap.Geocoder', function () {
              let geocoder = new AMap.Geocoder({})
              let lnglat = [lng, lat]
              geocoder.getAddress(lnglat, function (status, geoData) {
                if (status === 'complete' && geoData.info === 'OK') {
                  // result为对应的地理位置详细信息
                  console.log('获取选中地址的地理位置', geoData)
                  self.workRegions.FulleAddress = data.poi.name
                  self.workRegions.areaid = geoData.regeocode.addressComponent.adcode
                  self.workRegions.areaname = geoData.regeocode.addressComponent.district
                  self.workRegions.cityid = geoData.regeocode.addressComponent.adcode.substring(0,4)
                  self.workRegions.cityname = geoData.regeocode.addressComponent.city
                  self.workRegions.lat = data.poi.location.lat
                  self.workRegions.long = data.poi.location.lng
                  self.workRegions.provinceid = geoData.regeocode.addressComponent.adcode.substring(0,2)
                  self.workRegions.provincename = geoData.regeocode.addressComponent.province
                  self.work_address = geoData
                  return
                }
                self.$router.push({
                  name: self.prePage,
                })
              })
            })
          } else {
            //正向地理编码
            AMap.plugin('AMap.Geocoder', function () {
              let geocoder = new AMap.Geocoder({
                // city 指定进行编码查询的城市，支持传入城市名、adcode 和 citycode
                city: '全国'
              })

              geocoder.getLocation(data.poi.name, function (status, geoData) {
                if (status === 'complete' && geoData.info === 'OK') {
                  // result为对应的地理位置详细信息
                  console.log('获取选中地址的地理位置', geoData)
                  self.work_address = geoData
                  return
                }

                self.$router.push({
                  name: self.prePage,
                })
              })
            })
          }
        })

        self.autoCompleteComponent = autoCompleteComponent
        // 注册placeSearch组件
        self.placeSearchComponent = new AMap.PlaceSearch({
          // city 指定搜索所在城市，支持传入格式有：城市名、citycode和adcode
          city: self.currentCityName,
          extensions: 'all'
        })
      })
    },
    /** 面试地址关键词搜索 */
    onSearchAddress() {
      console.log('addressValue', this.addressValue)
      this.placeSearchComponent.search(this.addressValue, function (status, result) {
        // 查询成功时，result即对应匹配的POI信息
        console.log(status)
        console.log(result)
      })
    },
    /** 上班地址关键词搜索 */
    onSearchJobAddress() {
      console.log('addressJobValue', this.addressJobValue)
      this.placeSearchComponent.search(this.addressJobValue, function (status, result) {
        // 查询成功时，result即对应匹配的POI信息
        console.log(status)
        console.log(result)
      })
    },
    // 校验输入内容的字长
    wordCountLimit(val, wordCount) {
      return val.length <= wordCount
    },

    // 封装公共的上传图片函数
    async _reqUploadPicture(picture) {
      let formData = new FormData()
      formData.append('filename', picture.file)
      // 公司认证的图片
      const img_type = 'job_environment'
      // const res = await this.$api.uploadImg.uploadPhotos(formData, img_type)
      const res = await cosUploadImg(picture.file, img_type)
      if (res.code === 200) {
        return res.data
      }
    },

    // 上传图片
    uploadPhotoList(picture) {
      console.log('picture参数的file属性', picture.file)
      picture.status = 'uploading'
      picture.message = '上传中...'
      this._reqUploadPicture(picture).then(url => {
        if (!url) {
          Toast('图片上传失败!')
          picture.status = 'failed'
          picture.message = '上传失败'
        } else {
          picture.status = 'done'
        }

        // 不断的增加
        this.photos_list_url.push(url)
      })
    },

    costPlannedAmountChange(value){
      this.job_content = value
    },

    // 删除文件预览时，修改数据
    toDeleteAnyPreviewPhoto(file, detail) {
      if (this.photos_list_url.length === 0) {
        this.photos_list_url = []
      } else {
        // splice方法会改变原始数组
        this.photos_list_url.splice(detail.index, 1)
      }
    },

    // 上传图片
    uploadPhotoList_ForNote(picture) {
      console.log('picture参数的file属性', picture.file)
      picture.status = 'uploading'
      picture.message = '上传中...'
      this._reqUploadPicture(picture).then(url => {
        if (!url) {
          Toast('图片上传失败!')
          picture.status = 'failed'
          picture.message = '上传失败'
        } else {
          picture.status = 'done'
        }

        // 不断的增加
        this.job_notes_photos_url.push(url)
      })
    },

    // 删除文件预览时，修改数据
    toDeleteAnyPreviewPhoto_ForNote(file, detail) {
      if (this.job_notes_photos_url.length === 0) {
        this.job_notes_photos_url = []
      } else {
        // splice方法会改变原始数组
        this.job_notes_photos_url.splice(detail.index, 1)
      }
    },

    // 上传视频
    uploadPhotoList_ForJobVideos(picture) {
      console.log('picture参数的file属性', picture.file)
      picture.status = 'uploading'
      picture.message = '上传中...'
      this._reqUploadPicture(picture).then(url => {
        if (!url) {
          Toast('图片上传失败!')
          picture.status = 'failed'
          picture.message = '上传失败'
        } else {
          picture.status = 'done'
        }

        // 不断的增加
        this.job_videos_url.push(url)
      })
    },

    // 删除文件预览时，修改数据
    toDeleteAnyPreviewPhoto_ForJobVideos(file, detail) {
      if (this.job_videos_url.length === 0) {
        this.job_videos_url = []
      } else {
        // splice方法会改变原始数组
        this.job_videos_url.splice(detail.index, 1)
      }
    },

    previewJobVideos(file, detail) {
      console.warn(file, detail.index)
      // 跨组件通信，使用bus总线。
      this.$bus.$emit('toPreviewAndPlayVideo', this.job_videos_url[detail.index])
    },

    // 上传视频
    uploadPhotoList_ForNoteVideo(picture) {
      console.log('picture参数的file属性', picture.file)
      picture.status = 'uploading'
      picture.message = '上传中...'
      this._reqUploadPicture(picture).then(url => {
        if (!url) {
          Toast('图片上传失败!')
          picture.status = 'failed'
          picture.message = '上传失败'
        } else {
          picture.status = 'done'
        }

        // 不断的增加
        this.job_notes_video_url.push(url)
      })
    },

    // 删除文件预览时，修改数据
    toDeleteAnyPreviewPhoto_ForNoteVideo(file, detail) {
      if (this.job_notes_video_url.length === 0) {
        this.job_notes_video_url = []
      } else {
        // splice方法会改变原始数组
        this.job_notes_video_url.splice(detail.index, 1)
      }
    },

    previewVideos(file, detail) {
      console.warn(file, detail.index)
      // 跨组件通信，使用bus总线。
      this.$bus.$emit('toPreviewAndPlayVideo', this.job_notes_video_url[detail.index])
    },

    toChangePayWayId(value) {
      // 每一次切换，都置空数据
      this.first_value_input = ''
      this.second_value_input = ''
      this.third_value_input = ''
    },

    changePayDayId(id) {
      // 每一次切换，均置空数据
      this.payday_mode_name = ''
    },

    toUpdatePaydayModeName(value) {
      this.payday_mode_name = value
    },

    handNeedFullAddressValue_publish(regions, keyWord) {
      if (keyWord === 'interview') {
        this.interviewRegions = regions
      } else {
        this.workRegions = regions
      }
    },

    // 修改四级地址（清空详细地址）
    toUpdateRegionFourName(newObj, keyWord, regions) {
      console.log('更新toUpdateRegionFourName', newObj, keyWord);
      if (keyWord === 'interview') {
        // 面试（页面显示）
        this.showFullAddressObj_interview.region_four_name = newObj.region_four_name
        this.showFullAddressObj_interview.detail_address = '';

        // 面试的地理信息(接口需要的类型)
        Object.assign(this.interviewRegions, regions);

      } else {
        // 上班（页面显示）
        this.showFullAddressObj_work.region_four_name = newObj.region_four_name
        this.showFullAddressObj_work.detail_address = '';
        // 工作的地理信息(接口需要的类型)
        Object.assign(this.workRegions, regions);
      }
    },
    rightClick(e) {
      window.location.href = videoObj[e.path[4].childNodes[0].innerText]
    },
    // 修改详细地址
    toUpdateDetailAddress(newValue, keyWord) {
      if (keyWord === 'interview') {
        this.showFullAddressObj_interview.detail_address = newValue
        // 面试地址
        Object.assign(this.interviewRegions, {
          address: newValue,
          FulleAddress: (this.showFullAddressObj_interview.region_four_name || '') + newValue,
        });
      } else {
        this.showFullAddressObj_work.detail_address = newValue
        // 工作地址
        Object.assign(this.workRegions, {
          address: newValue,
          FulleAddress: (this.showFullAddressObj_work.region_four_name || '') + newValue,
        });
      }
    },

    onFailed(errorInfo) {
      console.log('failed', errorInfo.values)
      Toast('填写的信息可能有误！请上、下滑动进行检查。')
    },

    // 拼接、生成后端接口所需的字段
    _getNeedFieldVal(values) {
      const {
        job_category_id,
        enterprise_name,
        recruiting_position,
        recruiting_numbers,
        work_days,
        res_days,
        position_id,
        class_attribute_id,
        job_content,
        job_environment,
        completion_instructions,
        self_explanation,
        resignation_instructions,
        other_description,
        pay_money_mode,
        first_value_input,
        second_value_input,
        third_value_input,
        min_comprehensive_salary,
        max_comprehensive_salary,
        salary_description,
        lend_money_amount,
        payday_id,
        free_food,
        provide_food,
        food_allowance,
        social_security,
        insurance,
        encase,
        provide_lodging,
        housing_allowance,
        housing_fund,
        bonus,
        communication_subsidy,
        transport_allowance,
        IsWithPhone,
        IsWearCleanClothes,
        other_benefits,
        age,
        height,
        vision,
        educations,
        working_lifes_id,
        certificate_types,
        male_to_female_ratio,
        not_nationality,
        not_area,
        medical_examination,
        hair_style,
        tattoo_state,
        tips,
        id_card_num,
        bank_card_num,
        photo_color_size_quantity,
        personal_bags,
        medical_examinationFee,
        other_materials,
        contact,
        phone,
        wx_num,
        qq_num,
        application_time,
        car_fare_reimbursement,
        generation_of_commission,
        generation_instructions,
        downstream_cooperation_fee,
        downstream_cooperation_fee_desc,

        job_notes
      } = values

      const params = {
        // 第一部分
        job_category_id,
        enterprise_name,
        recruiting_position,
        recruiting_numbers,
        work_days,
        res_days,
        position_id,
        class_attribute_id,
        job_content:this.job_content,
        job_environment,
        completion_instructions,
        self_explanation,
        resignation_instructions,
        other_description,
        // 上传图片
        photo: this.photos_list_url,
        videos: this.job_videos_url,

        // 第二部分
        pay_way_id: pay_money_mode,
        first_value_input,
        second_value_input: second_value_input ? second_value_input : '',
        third_value_input: third_value_input ? third_value_input : '',
        min_comprehensive_salary,
        max_comprehensive_salary,
        // 薪资说明
        salary_remark: salary_description,
        // 可借支金额
        lend_money_amount: lend_money_amount || '',

        // 发薪方式
        payday: this.payday_ids ? this.payday_ids.join(',') : '',
        // 具体的发薪日
        pay_money_detail_date: payday_id === '0' ? '' : this.payday_mode_name,

        // 包吃
        free_food,
        // 供吃
        provide_food,
        // 饭补
        food_allowance,
        // 社保
        social_security,
        // 保险
        insurance,
        // 包住
        encase,
        // 供住
        provide_lodging,
        // 住房补贴
        housing_allowance,
        // 住房公积金
        housing_fund,
        // 奖金
        bonus,
        // 通讯补助
        communication_subsidy,
        // 交通补助
        transport_allowance,
        // 是否可带手机: 默认
        IsWithPhone:this.IsWithphones?this.IsWithphones.join(','):'',
        // 是否穿无尘服: 默认
        IsWearCleanClothes:this.IsWearCleanClothess?this.IsWearCleanClothess.join(','):'',
        // 福利
        other_benefits:other_benefits ? other_benefits.join(",") : '',

        // 第三部分
        age,
        height,
        vision:this.visions ? this.visions.join(',') : '',
        educations,
        working_lifes_id,
        certificate_types,
        male_to_female_ratio,
        // 招满的民族
        not_nationality,
        // 招满的区域
        not_area,
        medical_examination,
        hair_style,
        tattoo_state,
        tips,

        // 第四部分
        id_card_num,
        bank_card_num,
        photo_color_size_quantity,
        // 随身行李
        personal_bags,
        //  体检费
        medical_examinationFee,
        other_materials,

        // 第五部分
        contact,
        phone: phone,
        QQ: qq_num,
        WeChat: wx_num,
        interview_address: this.interviewRegions,
        // 面试时间
        application_time,
        work_address: this.workRegions,
        // 车费报销
        car_fare_reimbursement,
        generation_of_commission,
        // 代招费单位
        fee_unit: this.fee_unit,
        generation_instructions,
        // 下游合作费
        downstream_cooperation_fee,
        // 下游合作费的单位
        cooperation_fee_unit: this.cooperation_fee_unit,
        // 下游合作费说明
        downstream_cooperation_fee_desc,

        /*
         * 第五部分：备注
         * */
        job_notes,
        notes_photos: this.job_notes_photos_url ? this.job_notes_photos_url.join(',') : '',
        notes_videos: this.job_notes_video_url ? this.job_notes_video_url.join(',') : ''
      }

      // 拼接所需要的字段进行返回即可。
      return params
    },

    onSubmit(values) {
      // 将按钮置为非提交按钮（用于防抖）
      this.submitBtnType = 'button'
      this.submitBtnLoading = true
      this.timeNum = setTimeout(() => {
        this.submitBtnType = 'submit'
        this.submitBtnLoading = false
        clearTimeout(this.timeNum)
      }, 3000)

      if (values.min_comprehensive_salary*1 &&
        values.max_comprehensive_salary*1 &&
        (values.min_comprehensive_salary * 1 >= values.max_comprehensive_salary * 1)
      ){
        Toast('最小、最大综合工资填写不正确。或者最小综合工资不能大于最大综合工资！请修改')
        return null
      }

      const paramObj = this._getNeedFieldVal(values);


          let addressComponent = this.interview_address.regeocode ? this.interview_address.regeocode.addressComponent : ''
          let addressWorkComponent = this.work_address.regeocode ? this.work_address.regeocode.addressComponent : ''
          paramObj.interview_address.FulleAddress = this.addressValue
          paramObj.interview_address.areaid = addressComponent.adcode
          paramObj.interview_address.areaname = addressComponent.district
          paramObj.interview_address.cityid = addressComponent ? addressComponent.adcode.substring(0,4) : ''
          paramObj.interview_address.cityname = addressComponent.city
          paramObj.interview_address.lat = this.interview_lat
          paramObj.interview_address.long = this.interview_long
          paramObj.interview_address.provinceid = addressComponent ? addressComponent.adcode.substring(0,2) : ''
          paramObj.interview_address.provincename = addressComponent.province

          paramObj.work_address.FulleAddress = this.addressJobValue
          paramObj.work_address.areaid = addressWorkComponent.adcode
          paramObj.work_address.areaname = addressWorkComponent.district
          paramObj.work_address.cityid = addressWorkComponent ? addressWorkComponent.adcode.substring(0,4) : ''
          paramObj.work_address.cityname = addressWorkComponent.city
          paramObj.work_address.lat = this.work_lat
          paramObj.work_address.long = this.work_long
          paramObj.work_address.provinceid = addressWorkComponent ? addressWorkComponent.adcode.substring(0,2) : ''
          paramObj.work_address.provincename = addressWorkComponent.provinces
      // console.log('提交数据的拼接', JSON.stringify(paramObj));
      this.$emit('getJobContent', paramObj)
    },
    autofill_handle(data){
      console.log('data'+data)
      let _this = this;
      Object.keys(KeyWords).map(k=>{
        var words = KeyWords[k];
        if(k === 'pay_money_mode' || k==='working_lifes_id'){
          _this[k] = '';
          words.forEach(word=>{
            let find = data.includes(word.name);
            if(find){
              _this[k]=word.id;
            }
          });
        }
        else if(words.length>0){
          _this[k]=[];
          words.forEach(word=>{
            let find = data.includes(word.name);
            if(find){
              _this[k].push(word.id);
            }
          });
        }
      });
      Toast('已完成智能填写!')
    },
    set_contact_info(){
      const contactinfo = localStorage.getItem('contactinfo');
   //  if (contactinfo) {
   //    let obj = JSON.parse(contactinfo);
   //    this.job_notes = obj.job_notes||'';
   //    this.lend_money_amount = obj.lend_money_amount||'';
   //    this.recruiting_position= obj.recruiting_position||'';
   //    this.addressValue= obj.addressValue||'';
   //    this.addressJobValue= obj.addressJobValue||'';
	  // this.contact = obj.contact||'';
	  // this.phone = obj.phone||'';
   //  }
     setTimeout(()=>{
       // let type=this.btnShow?'save':'source'
       this.chDataRes('save')
     },1000)
    },
    fill_contact_handle(data){
      console.log(data);
      this.contact = data.contact||'';
	  this.phone = data.phone||'';
    },
    fill_salary_handle(){
      let val = this.first_value_input;
      let pos = SalaryInfo.calc_rules. findIndex(t=>t.id==val);
      if(pos!==-1){
        this.min_comprehensive_salary = SalaryInfo.calc_rules[pos].min;
        this.max_comprehensive_salary = SalaryInfo.calc_rules[pos].max;
      }else{
        this.min_comprehensive_salary='';
        this.max_comprehensive_salary='';
      }
    }

  },

  computed: {
    ...mapGetters(['allUserInfo']),
    calcPayMoneys(){
      return payMoneyMode.filter(i=>i.id === '3' || i.id === '8');
    },
    nocalcPayMoneys(){
      return payMoneyMode.filter(i=>i.id !== '3' && i.id !== '8');
    }
  }
}
</script>

<style lang="scss" scoped>
.com_infoForm {
  width: 100%;
  position: relative;
  .videosNote {
    /deep/ .van-ellipsis {
      display: none;
    }
  }
}
.greentext::v-deep .van-field__label,
  .greentext::v-deep .van-checkbox__label,
  .greentext::v-deep .van-radio__label
  {
    color:green;
  }
  .redtext::v-deep .van-icon.van-icon-search{
    color:red !important
  }
  .redtext::v-deep .van-field__label,
  .redtext::v-deep .van-field__control{
    color:red;
  }
  .greentxt::v-deep .van-radio__label{
    color:green;
  }
  .calc_salary{
    position: relative;
  }
  .calc_salary .calc_btn{
    position:absolute;
    top:1.7rem;
    left:0.45rem;
    color:green;
    font-size:0.38rem;
    z-index:90;
  }
</style>
